home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / amos / amoslist-0295.lzh / AMOSLIST / text0197.txt < prev    next >
Encoding:
Text File  |  1995-03-01  |  1.0 KB  |  21 lines

  1. >Try not to use anything but integers for games.  Many may disagree, but 
  2. >it is simply the only way to go.  Especially since the compiler doesn't 
  3. >work well with floats and not always with math functions.  In airTaxi, I 
  4. >had a purple sphere magnet that would pull all the cars toward itself.  
  5. >This involved some basic vector and magnetism functions, but I used all 
  6. >integers to do it.  Simply have an X value that represents 1/100th of a 
  7. >pixel, same with Y.  Then set dx or dy to 100 and the other to cos/sin * 100.
  8. >Your routine will perform faster too.  If you need more accuracy, use 256 
  9. >or more instead of 100.  Just divide by the number to get the real pixel 
  10. >position.
  11.  
  12.   Right - this offers lots of speed.  But then you have to watch out for
  13. the compiler's division bug - if you use negative numbers in division, it
  14. rounds the wrong way.  Having a separate "direction" variable can fix this,
  15. bug it's still annoying.
  16.  
  17.   --Andy Church (achurch@goober.mbhs.edu)
  18.     WWW: http://www.mbhs.edu/~achurch/
  19.     AMOS Web Site: http://www.mbhs.edu/~achurch/amos/
  20.  
  21.